home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / u_man / cat3 / Tcl / case.z / case
Encoding:
Text File  |  2002-10-03  |  3.4 KB  |  67 lines

  1.  
  2.  
  3.  
  4. ccccaaaasssseeee((((3333TTTTccccllll))))                                                          ccccaaaasssseeee((((3333TTTTccccllll))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      case - Evaluate one of several scripts, depending on a given value
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ccccaaaasssseeee _s_t_r_i_n_g ?iiiinnnn? _p_a_t_L_i_s_t _b_o_d_y ?_p_a_t_L_i_s_t _b_o_d_y ...?
  13.      ccccaaaasssseeee _s_t_r_i_n_g ?iiiinnnn? {_p_a_t_L_i_s_t _b_o_d_y ?_p_a_t_L_i_s_t _b_o_d_y ...?}
  14.  
  15.  
  16. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.      _N_o_t_e: _t_h_e ccccaaaasssseeee _c_o_m_m_a_n_d _i_s _o_b_s_o_l_e_t_e _a_n_d _i_s _s_u_p_p_o_r_t_e_d _o_n_l_y _f_o_r _b_a_c_k_w_a_r_d
  18.      _c_o_m_p_a_t_i_b_i_l_i_t_y.  _A_t _s_o_m_e _p_o_i_n_t _i_n _t_h_e _f_u_t_u_r_e _i_t _m_a_y _b_e _r_e_m_o_v_e_d _e_n_t_i_r_e_l_y.
  19.      _Y_o_u _s_h_o_u_l_d _u_s_e _t_h_e sssswwwwiiiittttcccchhhh _c_o_m_m_a_n_d _i_n_s_t_e_a_d.
  20.  
  21.      The ccccaaaasssseeee command matches _s_t_r_i_n_g against each of the _p_a_t_L_i_s_t arguments in
  22.      order.  Each _p_a_t_L_i_s_t argument is a list of one or more patterns.  If any
  23.      of these patterns matches _s_t_r_i_n_g then ccccaaaasssseeee evaluates the following _b_o_d_y
  24.      argument by passing it recursively to the Tcl interpreter and returns the
  25.      result of that evaluation.  Each _p_a_t_L_i_s_t argument consists of a single
  26.      pattern or list of patterns.  Each pattern may contain any of the wild-
  27.      cards described under ssssttttrrrriiiinnnngggg mmmmaaaattttcccchhhh.  If a _p_a_t_L_i_s_t argument is ddddeeeeffffaaaauuuulllltttt,
  28.      the corresponding body will be evaluated if no _p_a_t_L_i_s_t matches _s_t_r_i_n_g.
  29.      If no _p_a_t_L_i_s_t argument matches _s_t_r_i_n_g and no default is given, then the
  30.      ccccaaaasssseeee command returns an empty string.
  31.  
  32.      Two syntaxes are provided for the _p_a_t_L_i_s_t and _b_o_d_y arguments.  The first
  33.      uses a separate argument for each of the patterns and commands; this form
  34.      is convenient if substitutions are desired on some of the patterns or
  35.      commands.  The second form places all of the patterns and commands
  36.      together into a single argument; the argument must have proper list
  37.      structure, with the elements of the list being the patterns and commands.
  38.      The second form makes it easy to construct multi-line case commands,
  39.      since the braces around the whole list make it unnecessary to include a
  40.      backslash at the end of each line.  Since the _p_a_t_L_i_s_t arguments are in
  41.      braces in the second form, no command or variable substitutions are
  42.      performed on them;  this makes the behavior of the second form different
  43.      than the first form in some cases.
  44.  
  45.  
  46. KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
  47.      case, match, regular expression
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.